package com.szrt.day20170505.ch03;


import static org.junit.Assert.*;

import org.junit.Test;

public class QueueTest {
	
	
	
	@Test
	public void popTest() throws Exception {
		//1 搞1个头节点  head本身不为空 head.getNext
		Node head = new Node();
		System.out.println(head.getData());
		System.out.println(head.getNext());
		
		Queue queue =new Queue(head);
		
		System.out.println(queue);
		
		
		//要添加的节点
		
		Node node01 = new Node(2);
		
		queue.push(node01);
		
		System.out.println(queue);
		
		
		Node node02 = new Node(3);
		
		queue.push(node02);
		
		System.out.println(queue);
		
		Node jieguo1 = queue.pop();
		System.out.println(jieguo1.getData());
		
		Node jieguo2 = queue.pop();
		System.out.println(jieguo2.getData());
		
		Node jieguo3 = queue.pop();
		System.err.println(jieguo3==null?"":jieguo3.getData());
	}
	
	
	@Test
	public void pushTest() throws Exception {
		
		
		//1 搞1个头节点  head本身不为空 head.getNext
		Node head = new Node();
		System.out.println(head.getData());
		System.out.println(head.getNext());
		
		Queue queue =new Queue(head);
		
		System.out.println(queue);
		
		
		//要添加的节点
		
		Node node01 = new Node(2);
		
		queue.push(node01);
		
		System.out.println(queue);
		
		
		Node node02 = new Node(3);
		
		queue.push(node02);
		
		System.out.println(queue);
		
	}

}
